package ui;

import java.awt.BorderLayout;
import java.awt.Dimension;

import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;

import autoteam.tables.AutoTeamTableModel;

public class TablePanel extends JPanel {
	private static final long serialVersionUID = 4733353640362582814L;

	private JTable table;
	private AutoTeamTableModel model;

	private JScrollPane tableScrollPane;
	private JPanel buttonPanel;

//	private JButton addButton;
//	private JButton removeButton;
//	private JButton manageButton;

	public TablePanel(AutoTeamTableModel tableModel, JButton... buttons) 
	{
		model = tableModel;

		table = new JTable(model);
		table.setMaximumSize(new Dimension(1600, 720));
		table.setPreferredScrollableViewportSize(new Dimension(720, 400));
		table.setMinimumSize(new Dimension(480, 320));
		table.setRowSelectionAllowed(true);

		tableScrollPane = new JScrollPane(table);

//		addButton = new JButton("Add");
//		removeButton = new JButton("Remove");
//		manageButton = new JButton("Edit");

		buttonPanel = new JPanel( );
		for ( int i = 0; i < (buttons.length); i++ )
		    buttonPanel.add( buttons[i] );

		this.setLayout(new BorderLayout());
		this.add(buttonPanel, BorderLayout.NORTH);
		this.add(tableScrollPane, BorderLayout.CENTER);
	}
}
